package models;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.data.validation.MinSize;
import play.data.validation.Required;
import play.db.jpa.Model;
/**
 * 一个完整的故事、游记、经历
 * @author MrROY
 *
 */
@Entity
@Table(name="T_STORY")
public class Story extends Model {
	@Required
	@MinSize(value=8,message="标题最少8个字符")
	public String title;
	@Required
	@MinSize(value=8,message="描述最少8个字符")
	public String description;
	public String lastUpdateContent;
	public Date lastUpdateDate;
	@Required
	public Date createDate;
	@Required
	@ManyToOne
	public User user;
	@OneToMany(cascade=CascadeType.ALL,mappedBy="story")
	public List<Comment> comments;
	@OneToMany(mappedBy="story",cascade=CascadeType.ALL)
	public List<Section> sections;
}
